﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EIS_desktop
{
    public partial class Expenses : Form
    {
        private PayRoll prform;
        public Expenses()
        {
            InitializeComponent();
        }

        public Expenses(PayRoll objpr)
        {
            InitializeComponent();
            prform = objpr;
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            double  totalexpenses = 0;
            foreach (DataGridViewRow dgvrow in dataGridView1.Rows)
            {
                totalexpenses = totalexpenses +Convert.ToDouble(dgvrow.Cells[0].Value);
               
            }

            prform.AddToBalance(totalexpenses);
            this.Close();
        }
    }
}
